package com.greenold.commen.controller;

import com.greenold.commen.domain.Dto.ElderDto;
import com.greenold.commen.domain.Elder;
import com.greenold.commen.service.ElderService;
import com.greenold.common.core.domain.AjaxResult;
import com.mysql.cj.xdevapi.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/Elder")
public class ElderController {
    @Autowired
    private ElderService elderService;


    //获取已入住且未退住的老人列表
    @GetMapping("/list1")
    public AjaxResult list() {
        List<Elder> elders = elderService.selectElderListCheckInByElderId();
        return AjaxResult.success("没错兄弟你成功了",elders);
    }
    @GetMapping("/elderDtoList")
    public AjaxResult listDto() {
        List<ElderDto> elders = elderService.selectElderDtoList();
        return AjaxResult.success("没错兄",elders);
    }
    @GetMapping("/list")
    public AjaxResult getElderList() {
        return elderService.getAllElder();
    }


    @GetMapping("/customerid")
    public AjaxResult getCustomerId() {
        String customerId = elderService.getCustomerId();
        return AjaxResult.success(customerId); // 用AjaxResult包装，统一返回格式
    }


}
